<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <jsp:include page="../header.jsp"></jsp:include>
</head>

<body>
<header class="mui-bar mui-bar-nav">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <%--<a class="mui-icon mui-icon-plusempty mui-pull-right" href="#"><h4></h4></a>--%>
    <h1 class="mui-title">
        代理商添加
    </h1>
</header>
<jsp:include page="../commonMenu.jsp"></jsp:include>

<div class="mui-content">
    <form id="inputForm" class="mui-input-group">
        <div class="mui-input-row">
            <label>代理商名称</label>
            <input type="text" name="name" class="mui-input-clear" placeholder="请输入代理商名称">
        </div>
        <div class="mui-input-row">
            <label>上级代理</label>
            <input type="text" name="name" class="mui-input-clear" value="${parentId}">
        </div>
        <div class="mui-input-row">
            <label>密码</label>
            <input type="text" name="password" class="mui-input-clear" placeholder="请输入密码">
        </div>
        <div class="mui-input-row">
            <label>分成比例(%)</label>
            <input type="text" name="rate" class="mui-input-clear" placeholder="请输入分成比例">
        </div>
        <div class="mui-input-row">
            <label>联系人姓名</label>
            <input type="text" name="linkMan" class="mui-input-clear" placeholder="请输入联系人姓名">
        </div>
        <div class="mui-input-row">
            <label>手机号</label>
            <input type="text" name="linkTel" class="mui-input-clear" placeholder="请输入手机号">
        </div>
        <div class="mui-input-row">
            <label>详细地址</label>
            <input type="text" name="address" class="mui-input-clear" placeholder="请输入详细地址">
        </div>
        <div class="mui-input-row">
            <label>证件号码</label>
            <input type="text" name="idCard" class="mui-input-clear" placeholder="请输入证件号码">
        </div>
        <div class="mui-input-row">
            <label>户名</label>
            <input type="text" name="bankName" class="mui-input-clear" placeholder="请输入户名">
        </div>
        <div class="mui-input-row">
            <label>账户</label>
            <input type="text" name="bankAccount" class="mui-input-clear" placeholder="请输入账户">
        </div>
        <div class="mui-input-row">
            <label>开户行</label>
            <input type="text" name="bank" class="mui-input-clear" placeholder="请输入开户行">
        </div>
        </br></br>
    </form>
    <ul class="mui-table-view">
        <li class="mui-table-view-cell">
            <a id="logout" class="mui-btn-blue" style="text-align: center;cursor: pointer;" onclick="doAdd()">
                确认添加
            </a>
        </li>
    </ul>
</div>
</body>
<jsp:include page="../footer.jsp"></jsp:include>
<script src="${pageContext.request.contextPath}/static/mui/js/echarts-all.js"></script>
<script>
    function doAdd() {
        console.log($("#inputForm"));
        var data = $("#inputForm").serialize();
        console.log(data);
        mui.ajax('/distributor/manager/doAdd', {
            type: "post",
            data: data,
            dataType: "json",
            headers: {'Content-Type': 'application/x-www-form-urlencoded'},
            success: function (data) {
                console.info(data);
                if (data.code == 0) {
                    mui.toast("新增成功！");
                    setTimeout(function () {
                        window.location.href = base + "/distributor/index";
                    }, 1000);

                } else {
                    mui.toast("新增失败！");
                }
            },
            error: function (data) {
                mui.toast("新增失败！");
            }
        });
    }
</script>
</html>